package com.pinganfu.mock.server;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.Date;

import com.sun.org.apache.bcel.internal.generic.NEW;

public class client {
	
	public static void main(String[] args) throws Exception{
		
		//服务名称
		String serviceName="123 <?xml version='1.0' encoding=\"GB2312\"?><Cartoon><Message id=\"0000000000009501\"><CPRes id=\"CPRes\"><version>1.1.0</version><instId>CIBCC</instId><serialNo>0000000000009501</serialNo><bankCardNo>4512891016948106</bankCardNo><overdraft>A</overdraft></CPRes><Signature><SignatureValue>DDF11790</SignatureValue></Signature></Message></Cartoon> ";
		//String json="{\"SiebelMessage\":{\"test\":[],\"user_id\1234567897654321\",\"PointsLeft\":\"91620\",\"RedemPoint\":\"\",\"ErrorMessage\":\"成功\",\"ErrorCode\":\"00\",\"AmountLeft\":\"183.24\",\"MemberID\":\"\",\"RegisterName\":\"WLT_APP_010100143763185\",\"AdditionalAmount\":\"\"}}";
		
		//连接到服务器端  
	    //Socket socketConnection = new Socket(InetAddress.getLocalHost(), 8081); 
	    
	    Socket socketConnection = new Socket("127.0.0.1", 8081); 
		//Socket socketConnection = new Socket("10.59.33.49", 8081); 
	    
	    //使用ObjectOutputStream和ObjectInputStream进行对象数据传输  
	    ObjectOutputStream out = new ObjectOutputStream(socketConnection.getOutputStream());  
	    ObjectInputStream in = new ObjectInputStream(socketConnection.getInputStream());  
	    
	    //将客户端的对象数据流输出到服务器端去  
	    out.writeObject(serviceName);  
	    //out.writeObject(json);  
	    out.flush(); 
	    
	    //接受服务器端返回的数据
	    Object ssString = in.readObject();
	    //Object ssString = in.readObject();
	    System.out.println("客户端得到数据：" + ssString.toString());  
	    
	    
	}
	
    
    
}
